package java19_5_9.com.huweilong.io;

import java.io.*;

/**
 * @author 是阿秋啊
 * @date 2022/05/09 20:50
 **/
public class CopyFile {
    public static void main(String[] args) throws IOException {
        try (InputStream is = new FileInputStream("/Users/huweilong/Documents/IDEA/java19_-classcode/src.png")) {
            try (OutputStream os = new FileOutputStream("/Users/huweilong/Documents/IDEA/java19_-classcode/loac.png")) {
                while (true) {
                    byte[] b = new byte[1024];
                    int n = is.read(b);
                    if (n == -1) {
                        break;
                    }
                    os.write(b, 0, n);
                }
                os.flush();
            }
        }
    }
}
